import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';

class BGPhotoViewSimpleScreen extends StatelessWidget {
  const BGPhotoViewSimpleScreen({required this.imgUrl});
  final String imgUrl;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
            constraints: BoxConstraints.expand(height: MediaQuery.of(context).size.height),
            child: Stack(children: <Widget>[
              Positioned(
                  top: 0,
                  left: 0,
                  bottom: 0,
                  right: 0,
                  child: PhotoView(
                      imageProvider: NetworkImage(imgUrl),
                      minScale: PhotoViewComputedScale.contained * 0.8,
                      maxScale: PhotoViewComputedScale.covered * 1.8,
                      initialScale: PhotoViewComputedScale.contained * 0.9)),
              Positioned(
                  right: 10,
                  top: MediaQuery.of(context).padding.top,
                  child: IconButton(
                      icon: Icon(Icons.close, size: 30, color: Colors.white),
                      onPressed: () {
                        Navigator.of(context).pop();
                      }))
            ])));
  }
}
